<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let arr=[2020,"唐玮"];
        let [year,name]=arr;
        console.log(year,name);//2020 '唐玮'

        function func(){
            return [2020,"唐玮"];
        }
        let [years,names]=func();
        console.log(years,names);

    //...的用法
    let [...arrays]="撒的·";
    console.log(arrays);//['撒', '的', '·']

    let[,time_year]=["唐玮",2021];//如果我指向取后面的元素的话
    console.log(time_year);//2021

    //综合
    let [myname,...args]=["唐玮","2021",45126,45];
    console.log(myname);//唐玮
    console.log(args);// ['2021', 45126, 45]
        </script>
</body>
</html>